<template>
	<view class="container">
		<uni-list v-for="(item,index) in list">
			<uni-badge text="2" :absolute="absolute" :offset="offset">
				<uni-list-item :title="item.name" :note="item.password" :thumb="'/static'+item.icon" thumb-size="lg">
				</uni-list-item>
			</uni-badge>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"list": [{
						"id": 1,
						"name": "刘叶",
						"type": "信息工程学院",
						"icon": "/images/school3.jpg",
						"description": "朴首席",
					},
					{
						"id": 2,
						"name": "累烧陪",
						"type": "信息工程学院",
						"icon": "/images/school4.jpg",
						"description": "波波虎"
					},
				],
				offset: [20, 38],
				absolute: 'rightTop'
			}
		},
		methods: {
			onLoad() {
				uni.request({
					url: 'http://localhost:8090/freshmenapp/user/list',
					method: 'POST',
					data: {},
					success: res => {
						if (res.data.success) { //判断返回的登录响应是否成功
							this.list = res.data.list
							uni.showToast({
								title: '成功',
								duration:90000
							});
						} else {
							uni.showToast({
								title: '失败',
								icon: 'none'
							});
						}
					},
					fail: () => {
						uni.showToast({
							title: '网络错误',
							icon: 'none'
						});
					},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
		/* position: relative; */
	}
</style>
